package org.gdpu.model;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by HEWI2 on 3/12/14.
 */

@Entity
public class Application {

    /**
     * 申请编号
     */
    private String id;

    /**
     * 申请更换宿舍学生
     */
    private Student applyStudent;

    /**
     * 被更换学生
     */
    private Student exchange;

    /**
     * 申请时间
     */
    private Date applyTime;

    /**
     * 申请状态
     */
    private ApplyState applyState;

    /**
     * 审批人
     */
    private User check;

    /**
     * 备注
     */
    private String reMarks;

    @Id
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name = "applyStudent", nullable = false)
    public Student getApplyStudent() {
        return applyStudent;
    }

    public void setApplyStudent(Student applyStudent) {
        this.applyStudent = applyStudent;
    }

    @ManyToOne
    @JoinColumn(name = "exchangeStudent", nullable = false)
    public Student getExchange() {
        return exchange;
    }

    public void setExchange(Student exchange) {
        this.exchange = exchange;
    }

    @Temporal(TemporalType.TIMESTAMP)
    public Date getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(Date applyTime) {
        this.applyTime = applyTime;
    }

    @Enumerated(EnumType.ORDINAL)
    @Column(nullable = false, columnDefinition = "INT default 0", length = 2)
    public ApplyState getApplyState() {
        return applyState;
    }

    public void setApplyState(ApplyState applyState) {
        this.applyState = applyState;
    }

    @ManyToOne
    @JoinColumn(name = "checkMan")
    public User getCheck() {
        return check;
    }

    public void setCheck(User check) {
        this.check = check;
    }

    @Column(length = 2000)
    public String getReMarks() {
        return reMarks;
    }

    public void setReMarks(String reMarks) {
        this.reMarks = reMarks;
    }
}
